<%--
  Created by IntelliJ IDEA.
  User: 29276
  Date: 2021/8/14
  Time: 11:04
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>欢迎登录后台管理系统</title>
    <link href="css/style.css" rel="stylesheet" type="text/css" />
    <script language="JavaScript" src="js/jquery.js"></script>
    <script src="js/cloud.js" type="text/javascript"></script>
    <script type="text/javascript">
        if (window.location != window.top.location) {
            window.top.location.href = window.location.href;
        }
    </script>

    <script language="javascript">
        $(function(){
            $('.loginbox').css({'position':'absolute','left':($(window).width()-692)/2});
            $(window).resize(function(){
                $('.loginbox').css({'position':'absolute','left':($(window).width()-692)/2});
            })
        });
    </script>

    <script type="text/javascript">
        $(function () {
            $("#codeImg").click(function () {
                const img = $("#codeImg");
                img.attr("src", img.attr("src")+"?"+Math.random())
            })
        })

        $(function () {
            $("#userCode").blur(function () {
                const usercode = $("#userCode").val();

                console.log(usercode)
                if (usercode == null||usercode == "") {
                    $("#messageSpan").html("验证码不能为空").css("color", "red");
                    $("#submitBtn").prop("disabled", true);
                } else {
                    $.get("codeCheckServlet", {userCode:usercode}, function (data) {
                        $("#messageSpan").html("");
                        if (!eval(data)) {
                            $("#messageSpan").html("验证码不正确").css("color", "red");
                            $("#submitBtn").prop("disabled", true);
                            const img = $("#codeImg");
                            img.attr("src", img.attr("src")+"?"+Math.random())
                        } else {
                            $("#submitBtn").prop("disabled", false);
                        }
                    })
                }
            })
        })
    </script>

</head>

<body style="background-color:#1c77ac; background-image:url(images/light.png); background-repeat:no-repeat; background-position:center top; overflow:hidden;">



<div id="mainBody">
    <div id="cloud1" class="cloud"></div>
    <div id="cloud2" class="cloud"></div>
</div>


<div class="logintop">
    <span>欢迎访问OA系统</span>
    <ul>
        <li><a href="#">回首页</a></li>
        <li><a href="#">帮助</a></li>
        <li><a href="#">关于</a></li>
    </ul>
</div>

<div class="loginbody">

    <span class="systemlogo"></span>

    <div style="text-align: center">
        <span id="messageSpan" style="color: red">${requestScope.flog}</span>
    </div>

    <div class="loginbox loginbox2">
        <form action="userServlet" method="post">
            <ul>
                <li><input name="empId" type="text" class="loginuser" value="admin" onclick="JavaScript:this.value=''"/></li>
                <li><input name="password" type="password" class="loginpwd" value="密码" onclick="JavaScript:this.value=''"/></li>
                <li class="yzm">
                    <span><input id="userCode" name="" type="text" value=""/></span>
                    <cite>
                        <img id="codeImg" style="cursor:pointer;" src="codeServlet" alt="" width="115px" height="46px"/>
                    </cite>
                </li>
                <li><input id="submitBtn" name="" type="submit" disabled="disabled" class="loginbtn" value="登录"/><label><a href="emailCode.jsp">忘记密码？</a></label></li>
            </ul>
        </form>
    </div>

</div>





</body>

</html>

